package com.gexin.model.activity;

import com.gexin.model.activity.base.BaseMemberBillSpeedIntegral;
import org.apache.logging.log4j.core.util.UuidUtil;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 业务名称:  t_member_bill_speed_integral() 
 */
@SuppressWarnings("serial")
public class MemberBillSpeedIntegral extends BaseMemberBillSpeedIntegral<MemberBillSpeedIntegral> {
	public static final MemberBillSpeedIntegral dao = new MemberBillSpeedIntegral();


	public void setSpeedIntegralAndCoinAndBillCoupon(BigDecimal speedIntegral,BigDecimal coin,BigDecimal billCoupon,
													 BigDecimal reverse){
		this.setCoin(coin);
		this.setReverse(reverse);
		this.setSpeedIntegral(speedIntegral);
		this.setBillCoupon(billCoupon);
		this.setUpdateTime(new Date().getTime());
	}

	/*public MemberBillSpeedIntegral updateMemberBillSpeedIntegral(Integer id,String speed_integral,String forecast_speed_integral,String coin,String bill_coupon){
		MemberBillSpeedIntegral memberBillSpeedIntegral=MemberBillSpeedIntegral.dao.
	}*/

	public MemberBillSpeedIntegral setUserIdAndSpeedIntegralAndCoinAndBillCouponAndForecastAndRemainAndReverseAndDailyIncrement(
			String userId, BigDecimal speedIntegral, BigDecimal coin, BigDecimal billCoupon,
			BigDecimal forecastSpeedIntegral,BigDecimal remainSpeedIntegral, BigDecimal reverse,
			BigDecimal dailyIncrement){
		this.setId(UuidUtil.getTimeBasedUuid()+"");
		this.setUserId(userId);
		this.setCoin(coin);
		this.setBillCoupon(billCoupon);
		this.setSpeedIntegral(speedIntegral);
 		this.setDailyIncrement(dailyIncrement);
		this.setForecastSpeedIntegral(forecastSpeedIntegral);
		this.setRemainSpeedIntegral(remainSpeedIntegral);
		this.setReverse(reverse);
		this.setUpdateTime(new Date().getTime());
		return this;
	}





/*----------------------------------------------------------------------------------------------------------*/
	/**
	 * 获得增值积分
	 * @param userId
	 * @return
	 */
	public MemberBillSpeedIntegral getMemberBillSpeedIntegralByUserId(String userId) {
		MemberBillSpeedIntegral memberBillSpeedIntegral = MemberBillSpeedIntegral.dao.findFirst(
				"select * from t_member_bill_speed_integral where user_id=" + userId + " for update");
		return memberBillSpeedIntegral;
	}

	//查看用户共获得多少兑货卷
	public MemberBillSpeedIntegral onceMemberBillSpeedIntegral(Integer id){
		MemberBillSpeedIntegral memberBillSpeedIntegral=MemberBillSpeedIntegral.dao.findFirst("select speed_integral from t_member_bill_speed_integral where user_id=?",id);
		return memberBillSpeedIntegral;
	}
	public MemberBillSpeedIntegral onceeMemberBillSpeedIntegral(String id){
		MemberBillSpeedIntegral memberBillSpeedIntegral=MemberBillSpeedIntegral.dao.findFirst("select speed_integral from t_member_bill_speed_integral where user_id=?",id);
		return memberBillSpeedIntegral;
	}
}
